﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using Tool.Configs;

namespace Tool.Helper.Dm
{

    public static class RegisterHelper
    {
        [DllImport(DmConfigEntity.DmRegDllPath)]
        private static extern int SetDllPathA(string path, int mode);

 
        public static bool RegisteExcelDll()
        {
            //此程序需要以X86运行
            if (Environment.Is64BitProcess)
            {
                return false;
            }
            var setDllPathResult = SetDllPathA(DmConfigEntity.Info.DmClassDllPath, 1);
            if (setDllPathResult == 0)
            {
                // 加载 dm.dll 失败
                return false;
            }

            return true;
        }
    }
}
